home *** CD-ROM | disk | FTP | other *** search
/ Programmer Power Tools / Programmer Power Tools.iso / surfmodl / surfm203.arc / SURFSRC.ARC / WRITEINI.INC < prev   
Text File  |  1987-01-12  |  2KB  |  65 lines

  1. procedure WRITEINI;
  2. { Write the current settings into the INI file }
  3.  
  4. var Outfile: text;           { file to write to }
  5.     Notopen: boolean;        { flag file not open yet }
  6.     Ans: char;               { answer to user query }
  7.     Mat: integer;           { material # }
  8.     Lite: integer;           { light source # }
  9.  
  10. begin
  11.   assign (Outfile, Inifile);
  12.   Notopen := TRUE;
  13.   while (Notopen) do begin
  14.     {$I-}
  15.     rewrite (Outfile);
  16.     {$I+}
  17.     if (ioresult = 0) then
  18.       Notopen := FALSE
  19.     else begin
  20.       writeln ('Error writing file ', Inifile);
  21.       write ('Try again (Y/N)? ');
  22.       readln (Ans);
  23.       if (Ans = 'N') or (Ans = 'n') then
  24.         exit;
  25.     end; { if ioresult }
  26.   end; { while }
  27.  
  28.   writeln (Outfile, 4);               { version number of INI file }
  29.   writeln (Outfile, 1, ' ', GrSys + Grmode / 100.0);
  30.   writeln (Outfile, 2, ' ', Xeye, ' ', Yeye, ' ', Zeye);
  31.   writeln (Outfile, 3, ' ', Xfocal, ' ', Yfocal, ' ', Zfocal);
  32.   writeln (Outfile, 4, ' ', Magnify);
  33.   writeln (Outfile, 5, ' ', Viewtype);
  34.   { 6: Autoresolve removed }
  35.   for Mat := 1 to Nmatl do
  36.     writeln (Outfile, 7, ' ',Mat, ' ',R1[Mat],' ', R2[Mat],' ', R3[Mat], ' ',
  37.              Color[Mat], ' ',Ambient[Mat]);
  38.   for Lite := 1 to Nlite do
  39.     writeln (Outfile, 8, ' ',Lite, ' ', Xlite[Lite], ' ', Ylite[Lite], ' ',
  40.              Zlite[Lite], ' ',Intensity[Lite]);
  41. {  writeln (Outfile, 9, Ambient); }
  42.   if (Interpolate) then
  43.     writeln (Outfile, 10, ' ', Epsilon)
  44.   else
  45.     writeln (Outfile, 10, ' ', 0.0);
  46.   if (Shadowing) then
  47.     writeln (Outfile, 11, ' ',1)
  48.   else
  49.     writeln (Outfile, 11, ' ',0);
  50.   writeln (Outfile, 12, ' ', Ngraphchar);
  51.   writeln (Outfile, 13, ' ', Showaxes, ' ', Xaxislen, ' ', Yaxislen, ' ',
  52.            Zaxislen,' ', Axiscolor);
  53.   writeln (Outfile, 14, ' ', Nwindow);
  54.   if (Mono) then
  55.     writeln (Outfile, 15, ' ',Ncolors,' ', 1)
  56.   else
  57.     writeln (Outfile, 15, ' ',Ncolors,' ', 0);
  58.   if (Dorandom) then
  59.     writeln (Outfile, 16, ' ', Randshade)
  60.   else
  61.     writeln (Outfile, 16, ' ',0.0);
  62.   writeln (Outfile, 99);
  63.   close (Outfile);
  64. end; { procedure WRITEINI }
  65.